<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/main' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
      <!-- 权限列表 -->
      <el-table :data="rightsList" style="width: 100%;margin-top:15px;" stripe border>
        <el-table-column type="index"></el-table-column>
        <el-table-column prop="id" label="id" width="180"></el-table-column>
        <el-table-column prop="authName" label="权限管理" width="180"></el-table-column>
        <el-table-column prop="path" label="对应访问路径" width="180"></el-table-column>
        <el-table-column label="权限层级">
          <!-- 作用域插槽 -->
          <template slot-scope="scope">
              <el-tag v-if="scope.row.level==0">一级权限</el-tag>  
              <el-tag v-else-if="scope.row.level==1" type="success">二级权限</el-tag>  
              <el-tag v-else type="warning">三级权限</el-tag>  
              <!-- {{scope.row}} -->
          </template>
          
        </el-table-column>      
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      rightsList:[],
    };
  },
  created() {
    this.getRightsLsit()
  },
  mounted() {},
  watch: {},
  computed: {},
  methods: {
    getRightsLsit(){
      this.$axios.get('/rights/list').then(val=>{
        console.log(val);
        if(val.meta.status!=200){
          return this.$message.error(val.meta.msg)
        }
        this.rightsList=val.data
      })
    }
  },
};
</script>
<style lang="css" scoped>
</style>